package com.knowledge.action;

import java.util.Map;

import com.knowledge.DAO.KnowledgeDAO.DataSource;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class ApplyAddFriend extends ActionSupport {
	private String userId;
	private String friendId;

	@Override
	public String execute() throws Exception {
		
		System.out.println("&&&&&&&&&&&&&&&&"+userId+"%%%%%%" + friendId);
		/*Map map = ActionContext.getContext().getSession();
		String applyUserId = (String) map.get("userId");
		String userId = (String) map.get("friendId");*/
		
		boolean exist = DataSource.IsApplyExist(friendId, userId);

		if (exist == false) {
			DataSource.insertFriendApply(friendId, userId);
			return SUCCESS;
		} else {
			return SUCCESS;
		}
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getFriendId() {
		return friendId;
	}

	public void setFriendId(String friendId) {
		this.friendId = friendId;
	}
	
	
}
